
let View = require("View")

class ToastView extends View
{
    open(d)
    {
        let as = require('AudioSystem').share()
        as.play(d.sound)

        this.mRoot.zIndex = 10000

        let text  = this.find('1.1.t')

        text = text.getComponent(cc.Label)

        text.string = ogre.localize.get(d.text)

        let tim = 0.1

        this.startUpdate(
            (dt)=>{

                if (tim >= 0)
                {
                    tim += dt

                    if (tim > 1.6)
                    {
                        tim = -1

                        let vm = require("ViewMan").share()
                        vm.pop(this)
                    }
                }
            }
        )
    }
}

export default ToastView
